import json
from flask import Flask
from flask import render_template
from flask import jsonify
import Mysql2Flask # 导入python文件


app = Flask(__name__)
@app.route('/')
def main():
    return render_template('main.html')

@app.route('/c1')
def get_data():
    List=Mysql2Flask.cksj()
    print(List)
    return jsonify(List)

@app.route('/Sum')
def get_sum():
    Sum=0
    SumList=[]
    List=Mysql2Flask.cksj()
    for item in List:
        Sum+=item["value"][1]
        SumList.append(Sum)  # 保留每秒出站数量的累加结果，添加到列表中

        print(SumList)
        # 【output】(部分)
        # [26, 58, 94, 132, 166, 194, 223, 257, 286, 309, 336, 369, 403, 447, 476, 514, 542, 567, 597, ...]

    return json.dumps(SumList)


if __name__ == '__main__':
    app.run(debug=True)
